#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int lengthOfLastWord(char* s) {
    int len = strlen(s);
    int count = 0;
    int i = len - 1;
    while (s[i] == ' ')
    {
        i--;
    }
    for (i; i >= 0; i--)
    {
        if (s[i] == ' ')
            break;
        count++;
    }
    return count;
}


int main()
{
    char s[2344];
    gets(s);
    int ret=lengthOfLastWord(s);
    printf("%d", ret);
    return 0;
}